package com.util.security.mtoc;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
//MyInput.java: Contain the methods for reading int, double, and
// string values from the keyboard
public class MyInput {
	public static String readString() {
		BufferedReader br
				= new BufferedReader(new InputStreamReader(System.in), 1);

		// Declare and initialize the string
		String string = "";

		// Get the string from the keyboard
		try {
			string = br.readLine();
		} catch (IOException ex) {
			System.out.println(ex.toString());
			ex.printStackTrace();
		}

		// Return the string obtained from the keyboard
		return string;
	}

	// Read an int value from the keyboard
	public static int readInt() {
		return Integer.parseInt(readString());
	}

	// Read a double value from the keyboard
	public static double readDouble() {
		return Double.parseDouble(readString());
	}

	// Read a byte value from the keyboard
	public static byte readByte() {
		return Byte.parseByte(readString());
	}

	// Read a short value from the keyboard
	public static short readShort() {
		return Short.parseShort(readString());
	}

	// Read a long value from the keyboard
	public static long readLong() {
		return Long.parseLong(readString());
	}

	// Read a float value from the keyboard
	public static float readFloat() {
		return Float.parseFloat(readString());
	}
}
